package com.glsc.ngateway.common.base.domain.mysql.gateway.platform;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import javax.persistence.*;

@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "t_url", uniqueConstraints = {@UniqueConstraint(columnNames = {"url", "path"})})
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Url {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "component")
    private String component;

    @Column(name = "icon_cls")
    private String iconCls;

    @Column(name = "keep_alive")
    private Integer keepAlive;

    @Builder.Default
    @Column(name = "require_auth")
    private Integer requireAuth = 1;

    @Column(name = "name")
    private String name;

    @Column(name = "url")
    private String url;

    @Builder.Default
    @Column(name = "path")
    private String path = "";

    @Column(name = "parent_id")
    private Long parentId;

    @Builder.Default
    @Column(name = "b_is_del")
    private Integer deleted = 0;

}
